package com.gmrz.uaf.protocol.v1.schema;

import java.security.cert.Certificate;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import com.gmrz.uaf.common.Constants;

/**
 *  身份认证规范
 */
public final class AuthenticatorSpec {
    private transient String id;

    @SerializedName("aaid")
    @Expose
    private AAID aaid = null;


    @SerializedName("secureLevel")
    @Expose
    private Long secureLevel = Long.valueOf(-1L);

    @SerializedName("attestationRootCertificates")
    @Expose
    private List<Certificate> rootCertificates = null;

    @SerializedName("description")
    @Expose
    private String description = null;

    @SerializedName("authenticatorVersion")
    @Expose
    private Integer authenticatorVersion = Integer.valueOf(-1);

    @SerializedName("userVerificationDetails")
    @Expose
    private List<Set<VerificationMethodDescriptor>> userVerificationMethods = null;

    @SerializedName("attachmentHint")
    @Expose
    private Long validAttachmentTypes = Long.valueOf(-1L);

    @SerializedName("keyProtection")
    @Expose
    private Integer keyProtection = Integer.valueOf(-1);

    @SerializedName("matcherProtection")
    @Expose
    private Integer matcherProtection = Integer.valueOf(-1);

    @SerializedName("tcDisplay")
    @Expose
    private Integer secureDisplay = Integer.valueOf(-1);

    @SerializedName("tcDisplayContentType")
    @Expose
    private String displayContentType = null;

    @SerializedName("tcDisplayPNGCharacteristics")
    @Expose
    private List<PNGCharacteristics> displayPNGCharacteristics = null;

    @SerializedName("isSecondFactorOnly")
    @Expose
    private boolean isSecondFactorOnly = false;

    @SerializedName("icon")
    @Expose
    private String icon = null;

    @SerializedName("assertionScheme")
    @Expose
    private String assertionScheme = null;

    @SerializedName("authenticationAlgorithm")
    @Expose
    private int algorithm = -1;

    @SerializedName("publicKeyAlgAndEncoding")
    @Expose
    private int keyFormat;

    @SerializedName("attestationTypes")
    @Expose
    private List<Integer> attestationTypes;

    @SerializedName("upv")
    @Expose
    private Version[] upv = new Version[0];

    @SerializedName("status")
    private Constants.AuthenticatorSpecStatus status = null;
    private Timestamp createTimeStamp;
    private Timestamp updateTimeStamp;
    @Expose
    private String attestationRootCertificatesStr = null;

    private String authType = null;

    @SerializedName("supportedExtensions")
    @Expose
    private List<Extension> supportedExtensions;

    @SerializedName("devicePublicKeyExtensions")
    @Expose
    private List<Extension> devicePublicKeyExtensions;

    public List<Extension> getSupportedExtensions() {
        return supportedExtensions;
    }

    public void setSupportedExtensions(List<Extension> supportedExtensions) {
        this.supportedExtensions = supportedExtensions;
    }

    public List<Extension> getDevicePublicKeyExtensions() {
        return devicePublicKeyExtensions;
    }

    public void setDevicePublicKeyExtensions(List<Extension> devicePublicKeyExtensions) {
        this.devicePublicKeyExtensions = devicePublicKeyExtensions;
    }

    public List<Constants.SecureDisplay> getSecureDisplayAsList() {
        return Constants.SecureDisplay.forValue(this.secureDisplay.intValue());
    }

    public Integer getSecureDisplay() {
        return this.secureDisplay;
    }

    public void setSecureDisplay(Constants.SecureDisplay secureDisplay) {
        this.secureDisplay = Integer.valueOf(secureDisplay.getDisplay());
    }

    public void setSecureDisplay(int secureDisplay) {
        this.secureDisplay = Integer.valueOf(secureDisplay);
    }

    public List<Constants.KeyProtection> getKeyProtectionAsList() {
        return Constants.KeyProtection.forValue(this.keyProtection.intValue());
    }

    public Integer getKeyProtection() {
        return this.keyProtection;
    }

    public void setKeyProtection(int keyProtection) {
        this.keyProtection = Integer.valueOf(keyProtection);
    }

    public List<Constants.AttachmentHint> getAttachmentHintAsList() {
        return Constants.AttachmentHint.forValue(this.validAttachmentTypes.longValue());
    }

    public Long getAttachmentHint() {
        return this.validAttachmentTypes;
    }

    public void setAttachmentHint(long attachmentHint) {
        this.validAttachmentTypes = Long.valueOf(attachmentHint);
    }

    public void setAlgorithms(int algorithms) {
        this.algorithm = algorithms;
    }

    public int getAlgorithm() {
        return this.algorithm;
    }

    public void setKeyFormat(int keyFormat) {
        this.keyFormat = keyFormat;
    }

    public int getKeyFormat() {
        return this.keyFormat;
    }

    public String getDescription() {
        return this.description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getIcon() {
        return this.icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public List<Certificate> getRootCertificates() {
        return this.rootCertificates;
    }

    public void setRootCertificates(List<Certificate> rootCertificates) {
        this.rootCertificates = rootCertificates;
    }

    public boolean isSecondFactorOnly() {
        return this.isSecondFactorOnly;
    }

    public void setSecondFactorOnly(boolean secondFactorOnly) {
        this.isSecondFactorOnly = secondFactorOnly;
    }

    public List<Constants.AttestationType> getAttestationTypesAsList() {
        List<Constants.AttestationType> at = new ArrayList<Constants.AttestationType>();
        for (Integer i : this.attestationTypes) {
            at.add(Constants.AttestationType.forValue(i.intValue()));
        }
        return at;
    }

    public void setAttestationTypes(List<Integer> attestationTypes) {
        this.attestationTypes = attestationTypes;
    }

    public List<Integer> getAttestationTypes() {
        return this.attestationTypes;
    }

    public AAID getAAID() {
        return this.aaid;
    }

    public void setAAID(AAID aaid) {
        this.aaid = aaid;
    }

    public Constants.AuthenticatorSpecStatus getSpecStatus() {
        return this.status;
    }

    public void setSpecStatus(Constants.AuthenticatorSpecStatus status) {
        this.status = status;
    }

    public String getID() {
        return this.id;
    }

    public void setID(String id) {
        this.id = id;
    }

    public List<PNGCharacteristics> getDisplayPNGCharacteristics() {
        return this.displayPNGCharacteristics;
    }

    public void setDisplayPNGCharacteristics(List<PNGCharacteristics> displayPNGCharacteristics) {
        this.displayPNGCharacteristics = displayPNGCharacteristics;
    }

    public List<Set<VerificationMethodDescriptor>> getUserVerficationMethods() {
        return this.userVerificationMethods;
    }

    public void setUserVerficationMethods(List<Set<VerificationMethodDescriptor>> userVerificationMethods) {
        this.userVerificationMethods = userVerificationMethods;
    }

    public List<Constants.MatcherProtection> getMatcherProtectionAsList() {
        return Constants.MatcherProtection.forValue(this.matcherProtection.intValue());
    }

    public Integer getMatcherProtection() {
        return this.matcherProtection;
    }

    public void setMatcherProtection(Integer matcherProtection) {
        this.matcherProtection = matcherProtection;
    }

    public Integer getAuthenticatorVersion() {
        return this.authenticatorVersion;
    }

    public void setAuthenticatorVersion(Integer authenticatorVersion) {
        this.authenticatorVersion = authenticatorVersion;
    }

    public String getAssertionScheme() {
        return this.assertionScheme;
    }

    public void setAssertionScheme(String assertionScheme) {
        this.assertionScheme = assertionScheme;
    }

    public Version[] getUpv() {
        return this.upv;
    }

    public void setUpv(Version[] upv) {
        this.upv = upv;
    }

    public String getDisplayContentType() {
        return this.displayContentType;
    }

    public void setDisplayContentType(String displayContentType) {
        this.displayContentType = displayContentType;
    }

    public void setAuthenticatorVersion(int authenticatorVersion) {
        this.authenticatorVersion = Integer.valueOf(authenticatorVersion);
    }

    public Timestamp getCreateTimeStamp() {
        return this.createTimeStamp;
    }

    public void setCreateTimeStamp(Timestamp createTimeStamp) {
        this.createTimeStamp = createTimeStamp;
    }

    public Timestamp getUpdateTimeStamp() {
        return this.updateTimeStamp;
    }

    public void setUpdateTimeStamp(Timestamp updateTimeStamp) {
        this.updateTimeStamp = updateTimeStamp;
    }

    public String getAttestationRootCertificatesStr() {
        return attestationRootCertificatesStr;
    }

    public void setAttestationRootCertificatesStr(String attestationRootCertificatesStr) {
        this.attestationRootCertificatesStr = attestationRootCertificatesStr;
    }

    public String getAuthType() {
        return authType;
    }

    public void setAuthType(String authType) {
        this.authType = authType;
    }

    public Long getSecureLevel() {
        return secureLevel;
    }
}
